﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading.Tasks;
using System.Messaging;

namespace ProjectSpam
{
    partial class Service1 : ServiceBase
    {
        const string QueueName = "\\Private$\\projectSpamQueu";

        public Service1()
        {
            InitializeComponent();
        }

        protected override void OnStart(string[] args)
        {
            MessageQueue q = new MessageQueue(QueueName);
            q.Formatter = new XmlMessageFormatter(new Type[] { typeof(List<string>) });
            List<string> m = (List<string>) q.Receive().Body;
            string folder = m.First();
            m.Remove(m.First());
            // TODO: Add code here to start your service.
        }

        protected override void OnStop()
        {
            // TODO: Add code here to perform any tear-down necessary to stop your service.
        }
    }
}
